home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 71 / MOBICLIC 71.ISO / mac / DATA / COMMUN / temp0001 / 00282_Script_GESTION_OBJET_DEPLACABLE_CONTRAINT < prev    next >
Text File  |  2004-12-05  |  2KB  |  62 lines

  1. global gpiste_Tablo
  2. property p_cettePiste, p_Nodepiste,p_nom_Acteur,p_xmin,p_xmax,p_ymin,p_ymax
  3. property pX0,pY0,pX1,pY1
  4. ----------------------------------
  5. on getPropertyDescriptionList me
  6.   return [#pX0:[#comment: "Xmin:",#format:  #integer, #default: 0 ],\
  7.  #pY0:[#comment: "Ymin:",#format:  #integer, #default: 0 ],\
  8. #pX1:[#comment: "Xmax:",#format:  #integer, #default: 0 ],\
  9. #pY1:[#comment: "Ymax:",#format:  #integer, #default: 0 ]]
  10. end getPropertyDescriptionList
  11. ---------------------
  12. on beginsprite me
  13.   p_Nodepiste = me.spriteNum
  14.   p_cettePiste = sprite(p_Nodepiste)
  15.   p_nom_Acteur = p_cettePiste.member.name
  16.   gpiste_Tablo = p_Nodepiste
  17.   demi_W = p_cettePiste.member.width/2
  18.   demi_H  = p_cettePiste.member.height/2
  19.   p_xmin =  pX1 - demi_W
  20.   p_ymin =  pY1 - demi_H
  21.   p_xmax = pX0 +demi_W
  22.   p_ymax = pY0 +demi_H
  23. end
  24. ----------------------------------- 
  25. on mouseWithin
  26.   if the pauseState = 1 then exit
  27.   if the mouseH < pX0 or the mouseH > pX1 or the mouseV < pY0 or the mouseV > pY1 then
  28.     cursor -1
  29.     exit
  30.   end if
  31.   cursor 260
  32. end
  33. ---------------------------------
  34. on mouseDown
  35.   if the pauseState = 1 then exit
  36.   if the mouseH < pX0 or the mouseH > pX1 or the mouseV < pY0 or the mouseV > pY1 then
  37.     cursor -1
  38.     exit
  39.   end if
  40.   cursor 290
  41.   deltaX = the mouseH - p_cettePiste.locH
  42.   deltaY = the mouseV - p_cettePiste.locV
  43.   repeat while the mouseDown
  44.     u = the mouseH
  45.     v = the mouseV
  46.     p_cettePiste.locH = min(p_xmax,max(p_xmin,u - deltaX))
  47.     p_cettePiste.locV = min(p_ymax,max(p_ymin,v - deltaY) )
  48.     updateStage
  49.   end repeat
  50. end
  51. --------------------------------
  52. on mouseLeave
  53.   if the pauseState = 1 then exit
  54.   cursor -1
  55. end
  56. ----------------------------------- 
  57. on mouseUp
  58.   if the pauseState = 1 then exit
  59.   cursor 260
  60. end
  61. ----------------------------------- 
  62.